<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>词云图</title>
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<link rel="stylesheet" href="css/reset.css" />
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="js/echarts.min.js"></script>
		<script type="text/javascript" src="js/echarts-wordcloud.min.js"></script>
		<style>
			html,body{
				width: 100%;
				height: 100%;
			}
		</style>
	</head>
	<body>
		<div id="wordcloud">
			
		</div>
		<script>
			//企业画像词云图
			function wordCloud(id){
//				var echartWidth = $(window).width() * 0.356;
//				var echartHeight = $(window).height() * 0.506;
				var echartWidth = 480;
				var echartHeight = 320;
				// 基于准备好的dom，初始化echarts实例
				var myChart = echarts.init(document.getElementById(id));
				/*根据浏览器宽、高设置echarts 宽、高*/
				
				myChart.resize({
				    width: echartWidth,
				    height: echartHeight,
				});
				/*end*/
				var colors = ['#fda67e', '#81cacc', '#cca8ba', "#88cc81", "#82a0c5", '#fddb7e', '#735ba1', '#bda29a', '#6e7074', '#546570', '#c4ccd3'];
				var options = {
				    /*title:{
				        text:"词云图",
				        link:'https://github.com/ecomfe/echarts-wordcloud',
				        subtext: 'data-visual.cn',
				        sublink:'http://data-visual.cn',
				    },*/
				    tooltip: {},
				    series: [{
				        type: 'wordCloud',
				        gridSize: 10,
				        sizeRange: [12, 40],
				        rotationRange: [0, 0],
				        //shape: 'circle',
				        textStyle: {
				            normal: {
				                /*color: function(v) {
				                    return 'rgb(' + [
				                        Math.round(Math.random() * 160),
				                        Math.round(Math.random() * 160),
				                        Math.round(Math.random() * 160)
				                    ].join(',') + ')';
				                }*/
				               //color: ['#00CC00','#FFCC00','#FF0066']
				            	color: function(){
					               	var colors = ['#FF0099', '#FF3333', '#FF6633', "#FF33CC", "#9966FF", '#99CC33', '#CC6699', '#CCCC00', '#CC3366', '#66CCCC', '#9933CC'];
				                    return colors[parseInt(Math.random() * 10)];
				            	}
				            },
				            emphasis: {
				                shadowBlur: 10,
				                shadowColor: '#333'
				            }
				        },
				        data: [
				        { "name": '机器人',"value": 150},
				        { "name": '人工智能',"value": 308}, 
				        { "name": '工业机器人',"value": 438}, 
				        { "name": '股份有限公司（非上市）',"value": 86}, 
				        { "name": '在业',"value": 386}, 
				        { "name": '周玮',"value": 326}, 
				        { "name": '2120.4万元人民币',"value": 286}, 
				        { "name": '新三板',"value": 206}, 
				        { "name": '自动化',"value": 186}, 
				        { "name": '高新技术企业',"value": 46}, 
				        { "name": '玉山镇元丰路232号2号房',"value": 86}
				        ]
				    }]
				};
				// 使用刚指定的配置项和数据显示图表。
				myChart.setOption(options);
			}
			wordCloud("wordcloud");
		</script>
	</body>
</html>
